var aDiv = document.querySelectorAll("div");
var aP = document.querySelectorAll(".container");
var aEm = document.querySelectorAll("em");

for (var i = 0; i < aDiv.length; i++) {
  aDiv[i].index = i;
  aDiv[i].onclick = function () {
    if (aP[this.index].style.display == "none") {
      this.style.marginBottom = 0;
      aP[this.index].style.display = "block";
      aEm[this.index].style.borderTop = "0.5rem solid rgba(0, 0, 0, 0)";
      aEm[this.index].style.borderBottom = " 0.5rem solid white";
    } else {
      this.style.marginBottom = "0.5rem";
      aP[this.index].style.display = "none";
      aEm[this.index].style.borderTop = "0.5rem solid white";
      aEm[this.index].style.borderBottom = "0.5rem solid rgba(0, 0, 0, 0)";
    }
  }
}